import java.util.ArrayList;
import java.util.List;

import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;


public class XCompletedTableModel extends AbstractTableModel {

	private static final long serialVersionUID = 1L;
	
	JTable table;
    JScrollPane scrollpane;
    List<String[]> model= new ArrayList<String[]>();
    
	public XCompletedTableModel() {
		 
		 table = new JTable(this);
	     scrollpane = new JScrollPane(table);
	}
	
	private String[] columnNames = {"文件","位置"};
	public String getColumnName(int col) {
      return columnNames[col];
	}
    public int getColumnCount() { 
    	return 2; 
    }
    public int getRowCount() { return model.size();}
    public Object getValueAt(int row, int col) { 
    	String[] rate = model.get(row);
    	return rate[col]; 
    }

    public JTable table() {
    	return table;
    }
    public  JScrollPane scrollpane() {
		return scrollpane;
	}
    public void addRow(String[] rate) {
    	model.add(rate);
    	fireTableDataChanged();  
		
	}
    public void delRow(int index) {
    	model.remove(index);
    	fireTableDataChanged();  
		
	}
}
